import java.util.HashMap;
import java.util.*;

public class Test {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextLine()) {
            String s = in.nextLine();
            List<Character> list = new ArrayList<>();
            for (char ch : s.toCharArray()) {
                list.add(ch);
            }

            int prev = 0;
            int cur = prev + 1;
            while(true) {
                if (cur>=list.size()){
                    break;
                }
                if (list.get(prev) == list.get(cur)) {
                    list.remove(prev);
                    list.remove(prev);
                    if (prev != 0) {
                        prev--;
                        cur=prev+1;
                    }
                } else {
                    prev++;
                    cur=prev+1;
                }

            }
            if (list.isEmpty()){
                System.out.print(0);
            }
            System.out.println(list.toString());
        }
    }

    /**
     * 判断子序列
     * @param S
     * @param T
     * @return
     */
    public boolean isSubsequence(String S, String T) {
        HashMap<Character,Integer> pMap=new HashMap<>();
        //遍历S，储存S中所有字符
        for(char ch:S.toCharArray()){
            if(!pMap.containsKey(ch)){
                pMap.put(ch,1);
            }else{
                int val= pMap.get(ch);
                pMap.put(ch,val+1);
            }
        }
        //遍历T
        for (char ch:T.toCharArray()){
            if (pMap.containsKey(ch)){
                int val= pMap.get(ch);
                pMap.put(ch,val-1);
                if (pMap.get(ch)==0){
                    pMap.remove(ch);
                }
            }
        }

        if (pMap.isEmpty()){
            return true;
        }
        return false;
    }
}
